<?php
/**
 * Created on 09.03.2009 0:17:29
 * @author nikolai
 */

function cutNewLine($line) {
    // for win
    $result = str_ireplace("\r\n", "", $line);
    // for unix
    $result = str_ireplace("\n", "", $result);
    return $result;
}

function toOneHtmlLine($str) {
    //    $str = str_ireplace("\"", "'", $str);
    $str = str_ireplace("\r\n", "<br/>", $str);
    return $str;
}

function nbsp($str) {
    $str = str_ireplace("   ", "&nbsp;&nbsp;&nbsp;&nbsp;", $str);
    return $str;
}

function toHtml($str) {
    $str = str_ireplace("   ", "&nbsp;&nbsp;&nbsp;&nbsp;", $str);
    $str = str_ireplace("\r\n", "<br/>\r\n", $str);
    return $str;
}

function replaceEscapes($str) {
    $str = str_ireplace("\\\"", "\"", $str);
    return $str;
}

function containsStr($array, $str) {
    if (!$array) {
        return false;
    }

    for($i=0; $i < count($array); $i++) {
        if (strcmp($str, $array[$i]) == 0) {
            return true;
        }
    }
    return false;
}
?>
